Skip to content

feat(application): add --share-token to run commands - #688

Open
dima-aignostics wants to merge 5 commits into
mainfrom
feat/PYSDK-145-read-run-with-share-token
Open

feat(application): add --share-token to run commands#688
dima-aignostics wants to merge 5 commits into
mainfrom
feat/PYSDK-145-read-run-with-share-token

Conversation

@dima-aignostics

@dima-aignostics dima-aignostics commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Add --share-token argument to next commands to the uvx aignostics application run group:

describe
dump-metadata
dump-item-metadata
result download

@dima-aignostics
dima-aignostics requested a review from a team as a code owner June 22, 2026 08:46
@dima-aignostics
dima-aignostics force-pushed the feat/PYSDK-145-read-run-with-share-token branch 4 times, most recently from b524be7 to 9510e92 Compare June 22, 2026 11:36
@dima-aignostics
dima-aignostics force-pushed the feat/PYSDK-132-add-run-sharing-to-python-sdk branch 6 times, most recently from 6ae872e to 0bc4980 Compare June 23, 2026 21:15
Base automatically changed from feat/PYSDK-132-add-run-sharing-to-python-sdk to main June 29, 2026 08:04
@dima-aignostics
dima-aignostics force-pushed the feat/PYSDK-145-read-run-with-share-token branch 3 times, most recently from 5ab4c44 to 23c6793 Compare June 30, 2026 14:04
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.23077% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/aignostics/application/_cli.py 91.30% 1 Missing and 1 partial ⚠️
src/aignostics/application/_utils.py 80.00% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/aignostics/application/_service.py 64.06% <100.00%> (-2.56%) ⬇️
src/aignostics/platform/resources/runs.py 86.57% <100.00%> (+1.05%) ⬆️
src/aignostics/application/_utils.py 88.66% <80.00%> (-4.26%) ⬇️
src/aignostics/application/_cli.py 79.43% <91.30%> (-0.23%) ⬇️

... and 4 files with indirect coverage changes

…DK-145)

Recipients holding a share token secret can now describe a run without
OAuth login by passing --share-token <secret> to `application run describe`.
The token is used directly as the Bearer token for platform API requests.

- Adds `--share-token` option to `run describe`; when set, creates a
  `Client(token_provider=…)` bypassing OAuth, with `hide_platform_queue_position=True`
- Catches `UnauthorizedException` and `ForbiddenException` when using a share
  token and surfaces a clear "Access denied" message with exit code 1
- Adds 5 integration tests covering success (text + JSON), not-found,
  unauthorized, and forbidden paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dima-aignostics
dima-aignostics force-pushed the feat/PYSDK-145-read-run-with-share-token branch from 23c6793 to c3c99ef Compare June 30, 2026 15:38
@dima-aignostics dima-aignostics changed the title feat(application): add --share-token to run describe CLI command (PYS… feat(application): add --share-token to run commands Jul 1, 2026
@dima-aignostics
dima-aignostics force-pushed the feat/PYSDK-145-read-run-with-share-token branch from 01154f0 to 8bad631 Compare July 1, 2026 11:23
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

Resolve conflict in application/_cli.py: keep both the --share-token
option (this branch) and the --show-checksum option (main) on the
run dump-metadata and dump-item-metadata commands. The command bodies
already reference both parameters; only the signatures collided.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@olivermeyer
olivermeyer force-pushed the feat/PYSDK-145-read-run-with-share-token branch from 13331ff to d8936d0 Compare August 3, 2026 15:00
Adds a --share-token option to `application run describe / dump-metadata /
dump-item-metadata / result download` (PYSDK-145), granting an authenticated
user access to a run that has been shared with them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@olivermeyer
olivermeyer force-pushed the feat/PYSDK-145-read-run-with-share-token branch from d8936d0 to b2023b8 Compare August 5, 2026 08:55
Address code-review findings on PR #688:
- Fix two _service.py docstrings that wrongly described share-token access as
  "without OAuth"/"unauthenticated"; share tokens elevate an already
  OAuth-authenticated user's access.
- Rewrite the three forbidden CLI tests to raise ForbiddenException from the
  real source (run.details()/run.results()) instead of application_run, which
  wraps all exceptions into RuntimeError in production.
- Normalize an empty --share-token to None at the application_run choke point
  so a blank value falls back to the normal authenticated read; add service
  tests for both branches.
- Make share_token_access_denied_message a pure builder and move the warning
  log to the four CLI call sites (command-query separation).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants